{% macro gen_table(prices, template_mapping, current_user, kwargs) %}
    <table id="brand-table"
           class="table table-bordered table-hover table-condensed table-striped">
        <thead>
        <tr>
            <th>序号</th>
            <th>产品类型</th>
            <th>产品品牌</th>
            <th>产品型号</th>
            <th>标题</th>
            <th>报价人数</th>
            <th>最低价</th>
            <th>最高价</th>
            <th>操作</th>
        </tr>
        </thead>
        <tbody>
        {% for each in prices %}
            {% with template = template_mapping[each.product_template_id] %}
                <tr>
                    <td>{{ loop.index }}</td>
                    <td>{{ template.product_type_name }}</td>
                    <td>{{ template.brand }}</td>
                    <td>{{ template.brand_model_name }}</td>
                    <td>{{ template.title_display }}</td>
                    <td>{{ each.price_count }}</td>
                    <td>{{ each.min_price or each.is_consult and '议价' }}</td>
                    <td>{{ each.max_price or each.min_price or each.is_consult and '议价' }}</td>
                    <td>
                        <a
                                class="btn btn-xs btn-primary"
                                href="{{ url_for('product_bp.product_info', product_id=each.product_template_id) }}"
                                name="product-info"
                                target="_blank"
                        >产品信息</a>
                        <a
                                class="btn btn-xs btn-success"
                                href="{{ url_for('product_bp.price_detail', template_id=each.product_template_id) }}"
                                name="product-price"
                                target="_blank"
                        >报价详情</a>
                    </td>

                </tr>
            {% endwith %}
        {% endfor %}
        </tbody>
    </table>
{% endmacro %}
